package com.linxz.ui.spraycarview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RadioGroup;


public class ClearRadioGroup extends RadioGroup {
    private OnCheckedChangeListener mListener;
    public ClearRadioGroup(Context context) {
        super(context);
    }

    public ClearRadioGroup(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
        super.setOnCheckedChangeListener(listener);
        mListener=listener;
    }
    public OnCheckedChangeListener  getOnCheckedChangeListener(){
        return mListener;
    }

    @Override
    public void clearCheck() {
        OnCheckedChangeListener listener=getOnCheckedChangeListener();
        setOnCheckedChangeListener(null);
        super.clearCheck();
        if(listener!=null){
            listener.onCheckedChanged(this,getCheckedRadioButtonId());
        }
        setOnCheckedChangeListener(listener);
    }
}
